Check if a variable has been declared.
IsDeclared ( expression )
Parameters
expression | string representing name of the variable to be checked. |
Return Value
Success: | Returns 1 for Global variable or variable declared outside functions. |
Special: | -1 for Local variable. |
Failure: | Return 0 when no variable can be found. |
Remarks
If there is a need to use IsDeclared() to check that a variable exists, then in most situations Assign() should be used to create/write to the variable and Eval() should be used to read from the variable.
Related
Assign, Eval
Example
If Not IsDeclared ("a") then
MsgBox(0,"", "$a is NOT declared") ; $a has never been assigned
EndIf
$a=1
If IsDeclared ("a") then
MsgBox(0,"", "$a IS declared" ) ; due to previous $a=1 assignment
EndIf